package com.anyi.controller;


import com.anyi.common.lang.Result;
import com.anyi.entity.Category;
import com.anyi.service.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author anyi
 * @since 2022-04-14
 */
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    CategoryService categoryService;
    @GetMapping
    public Result getCategories(){
        List<Category> list = categoryService.list(new QueryWrapper<Category>(null));
        return Result.success(list);
    }
}
